{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 210,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['Xiaoming', 'Panpan', 'Dongdong']\n",
      "['Xiaoming', 'Panpan', 'Yueyue', 'Dongdong']\n",
      "['Xiaoming', 'Panpan', 'Yueyue', '东东']\n",
      "['Xiaoming', 'Panpan', ['Mingming', 'Xiaoyun'], 'Yueyue', '东东']\n",
      "1\n",
      "['Xiaoming', 'Panpan', ['Mingming', 'Xiaoyun'], 'Yueyue', '东东', 1, 2, 3, 4, 5]\n",
      "['Yueyue', '东东', 1, 2]\n",
      "['Yueyue', 1, 3]\n",
      "[2, 3, 4, 5]\n",
      "0 Xiaoming\n",
      "1 Panpan\n",
      "2 ['Mingming', 'Xiaoyun']\n",
      "3 Yueyue\n",
      "4 东东\n",
      "5 1\n",
      "6 2\n",
      "7 3\n",
      "8 4\n",
      "9 5\n",
      "['Xiaoming', 'Panpan', ['Mingming', 'Xiaoyun'], 'Yueyue', '东东', 1, 2, 3, 4, 5]\n",
      "[]\n",
      "[-1]\n",
      "[-1, 'Panpan']\n",
      "[-1, 'Panpan', -1]\n",
      "[-1, 'Panpan', -1, 'Yueyue']\n",
      "[-1, 'Panpan', -1, 'Yueyue', -1]\n",
      "[-1, 'Panpan', -1, 'Yueyue', -1, 1]\n",
      "[-1, 'Panpan', -1, 'Yueyue', -1, 1, -1]\n",
      "[-1, 'Panpan', -1, 'Yueyue', -1, 1, -1, 3]\n",
      "[-1, 'Panpan', -1, 'Yueyue', -1, 1, -1, 3, -1]\n",
      "[-1, 'Panpan', -1, 'Yueyue', -1, 1, -1, 3, -1, 5]\n"
     ]
    }
   ],
   "source": [
    "# 1.列表操作\n",
    "# 1.1\n",
    "names = []\n",
    "names.append('Xiaoming')\n",
    "names.append('Panpan')\n",
    "names.append('Dongdong')\n",
    "print(names)\n",
    "\n",
    "# 1.2\n",
    "names.insert(names.index('Dongdong'), 'Yueyue')\n",
    "print(names)\n",
    "\n",
    "# 1.3\n",
    "names[names.index('Dongdong')] = '东东'\n",
    "print(names)\n",
    "\n",
    "# 1.4\n",
    "names.insert(names.index('Panpan')+1, ['Mingming', 'Xiaoyun'])\n",
    "print(names)\n",
    "\n",
    "# 1.5\n",
    "print(names.index('Panpan'))\n",
    "\n",
    "# 1.6\n",
    "new_list = [1, 2, 3, 4, 5]\n",
    "names.extend(new_list)\n",
    "print(names)\n",
    "\n",
    "# 1.7\n",
    "print(names[3:7])\n",
    "\n",
    "# 1.8\n",
    "print(names[3:9:2])\n",
    "\n",
    "# 1.9\n",
    "print(names[-4:])\n",
    "\n",
    "# 1.10\n",
    "for item in names:\n",
    "    print(names.index(item), item)\n",
    "\n",
    "# 1.11\n",
    "print(names)\n",
    "new_names = []\n",
    "for i in range(len(names)):\n",
    "    print(new_names)\n",
    "    if i % 2 == 0:\n",
    "        new_names.append(-1)\n",
    "        continue\n",
    "    new_names.append(names[i])\n",
    "print(new_names)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 219,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(87, 100, 96, 77, 69, 83, 91, 777, 63, 85)\n",
      "100\n",
      "(87, 100, 96, 77, 69, 83)\n",
      "1\n",
      "1\n",
      "10\n",
      "[87, 100, 96, 77, 69, 83, 91, 777, 63, 85]\n",
      "(87, 100, 96, 77, 69, 83, 91, 777, 63, 85)\n",
      "(87, 100, 96, 77, 69, 83, 91, 777, 63, 85, 34, 67)\n"
     ]
    }
   ],
   "source": [
    "# 2.元组操作\n",
    "# 2.1\n",
    "grades = (87, 100, 96, 77, 69, 83, 91, 777, 63, 85)\n",
    "print(grades)\n",
    "\n",
    "# 2.2\n",
    "print(grades[1])\n",
    "\n",
    "# 2.3\n",
    "print(grades[:6])\n",
    "\n",
    "# 2.4\n",
    "print(grades.count(77))\n",
    "\n",
    "# 2.5\n",
    "print(grades.index(100))\n",
    "\n",
    "# 2.6\n",
    "print(len(grades))\n",
    "\n",
    "# 2.7\n",
    "list_grades = list(grades)\n",
    "print(list_grades)\n",
    "\n",
    "# 2.8\n",
    "tup_grades = tuple(list_grades)\n",
    "print(tup_grades)\n",
    "\n",
    "# 2.9\n",
    "grades_other = (34, 67)\n",
    "grades += grades_other\n",
    "print(grades)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.7.4 ('base')",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "6b54d2f983b5157715fde0e58789eadff3cf7704e33ef6c1c137e8c67eba30c8"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
